package com.yy.train.ticket.train.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yy.train.ticket.goout.TrainBox;
import com.yy.train.ticket.goout.TrainSeat;
import com.yy.train.ticket.into.page.BoxPage;
import com.yy.train.ticket.into.page.LinePage;
import com.yy.train.ticket.utils.R;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;



import com.yy.train.ticket.train.dao.TtTrainSeatDao;
import com.yy.train.ticket.train.entity.TtTrainSeatEntity;
import com.yy.train.ticket.train.service.TtTrainSeatService;

import javax.annotation.Resource;
import java.util.List;


@Service("ttTrainSeatService")
public class TtTrainSeatServiceImpl extends ServiceImpl<TtTrainSeatDao, TtTrainSeatEntity> implements TtTrainSeatService {

@Resource
    TtTrainSeatDao ttTrainSeatDao;
    @Override
    public R trainSeatlist(Long trainId) {
        List<TrainSeat> li= ttTrainSeatDao.trainSeatlist(trainId);
        return   R.ok(li);
    }

    @Override
    public R trainSeatPage(LinePage seatPage) {



        Page<LinePage> page = new Page<>(seatPage.getPageNum(), seatPage.getPageSize());

        IPage<TrainSeat> list = ttTrainSeatDao.trainSeatPage(page, seatPage);
        return R.ok(list);
    }


}